/**
 * 
 */
package gui;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.border.EmptyBorder;

/**
 * @author Administrator
 * 
 */
public class MainFrame extends JFrame
{
	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = -1306687705594790857L;

	/** The content pane. */
	private JPanel contentPane;

	/**
	 * Create the frame.
	 */
	public MainFrame()
	{
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setBounds(100, 100, 450, 300);
		this.contentPane = new JPanel();
		this.contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		this.contentPane.setLayout(new BorderLayout(0, 0));
		this.setContentPane(this.contentPane);

		// CheckBoxNode accessibilityOptions[] = {
		// new CheckBoxNode("Move system caret with focus/selection changes", false),
		// new CheckBoxNode("Always expand alt text for images", true) };
		// CheckBoxNode browsingOptions[] = {
		// new CheckBoxNode("Notify when downloads complete", true),
		// new CheckBoxNode("Disable script debugging", true),
		// new CheckBoxNode("Use AutoComplete", true),
		// new CheckBoxNode("Browse in a new process", false) };
		// Vector accessVector = new NamedVector("Accessibility", accessibilityOptions);
		// Vector browseVector = new NamedVector("Browsing", browsingOptions);
		// Object rootNodes[] = { accessVector, browseVector };
		// Vector rootVector = new NamedVector("Root", rootNodes);
		//
		// JTree tree = new JTree(rootVector);
		// CheckBoxNodeRenderer renderer = new CheckBoxNodeRenderer();
		// tree.setCellRenderer(renderer);
		//
		// tree.setCellEditor(new CheckBoxNodeEditor(tree));
		// tree.setEditable(true);

		CheckNode accessibilityNode = new CheckNode("Accessibility", true, true);
		CheckNode acc1 = new CheckNode("Move system caret with focus/selection changes");
		CheckNode acc2 = new CheckNode("Always expand alt text for images");
		accessibilityNode.add(acc1);
		accessibilityNode.add(acc2);
		CheckNode browsingNode = new CheckNode("Browsing");
		CheckNode bro1 = new CheckNode("Notify when downloads complete");
		CheckNode bro2 = new CheckNode("Disable script debugging");
		CheckNode bro3 = new CheckNode("Use AutoComplete");
		CheckNode bro4 = new CheckNode("Browse in a new process");
		browsingNode.add(bro1);
		browsingNode.add(bro2);
		browsingNode.add(bro3);
		browsingNode.add(bro4);
		CheckNode root = new CheckNode("Root");
		root.add(accessibilityNode);
		root.add(browsingNode);

		JTree tree = new JTree(root);
		CheckNodeTreeCellRenderer renderer = new CheckNodeTreeCellRenderer();
		tree.setCellRenderer(renderer);
		tree.setCellEditor(new CheckNodeTreeCellEditor(tree));
		tree.setEditable(true);

		JScrollPane scrollPane = new JScrollPane(tree);
		this.contentPane.add(scrollPane, BorderLayout.CENTER);

		JPanel buttonsPanel = new JPanel();
		JButton btn1 = new JButton("Button 1");
		JButton btn2 = new JButton("Button 2");
		buttonsPanel.add(btn1, FlowLayout.LEFT);
		buttonsPanel.add(btn2, FlowLayout.LEFT);
		this.contentPane.add(buttonsPanel, BorderLayout.SOUTH);
		this.setSize(450, 300);
		this.setVisible(true);
	}

}
